/**
 */
package usixmlcui.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import usixmlcui.ConcreteGraphicalStyle;
import usixmlcui.Font;
import usixmlcui.FontType;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Font</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.FontImpl#getType <em>Type</em>}</li>
 *   <li>{@link usixmlcui.impl.FontImpl#getSize <em>Size</em>}</li>
 *   <li>{@link usixmlcui.impl.FontImpl#isIsBold <em>Is Bold</em>}</li>
 *   <li>{@link usixmlcui.impl.FontImpl#isIsItalic <em>Is Italic</em>}</li>
 *   <li>{@link usixmlcui.impl.FontImpl#getTextFont <em>Text Font</em>}</li>
 *   <li>{@link usixmlcui.impl.FontImpl#getEReference0 <em>EReference0</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FontImpl extends EObjectImpl implements Font {
	/**
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected static final FontType TYPE_EDEFAULT = FontType.ARIAL_LITERAL;

	/**
	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected FontType type = TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getSize() <em>Size</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSize()
	 * @generated
	 * @ordered
	 */
	protected static final int SIZE_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getSize() <em>Size</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSize()
	 * @generated
	 * @ordered
	 */
	protected int size = SIZE_EDEFAULT;

	/**
	 * The default value of the '{@link #isIsBold() <em>Is Bold</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isIsBold()
	 * @generated
	 * @ordered
	 */
	protected static final boolean IS_BOLD_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isIsBold() <em>Is Bold</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isIsBold()
	 * @generated
	 * @ordered
	 */
	protected boolean isBold = IS_BOLD_EDEFAULT;

	/**
	 * The default value of the '{@link #isIsItalic() <em>Is Italic</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isIsItalic()
	 * @generated
	 * @ordered
	 */
	protected static final boolean IS_ITALIC_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isIsItalic() <em>Is Italic</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isIsItalic()
	 * @generated
	 * @ordered
	 */
	protected boolean isItalic = IS_ITALIC_EDEFAULT;

	/**
	 * The cached value of the '{@link #getTextFont() <em>Text Font</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTextFont()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalStyle textFont;

	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalStyle eReference0;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FontImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.FONT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FontType getType() {
		return type;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setType(FontType newType) {
		FontType oldType = type;
		type = newType == null ? TYPE_EDEFAULT : newType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.FONT__TYPE, oldType, type));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getSize() {
		return size;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSize(int newSize) {
		int oldSize = size;
		size = newSize;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.FONT__SIZE, oldSize, size));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isIsBold() {
		return isBold;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsBold(boolean newIsBold) {
		boolean oldIsBold = isBold;
		isBold = newIsBold;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.FONT__IS_BOLD, oldIsBold, isBold));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isIsItalic() {
		return isItalic;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsItalic(boolean newIsItalic) {
		boolean oldIsItalic = isItalic;
		isItalic = newIsItalic;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.FONT__IS_ITALIC, oldIsItalic, isItalic));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalStyle getTextFont() {
		if (textFont != null && textFont.eIsProxy()) {
			InternalEObject oldTextFont = (InternalEObject)textFont;
			textFont = (ConcreteGraphicalStyle)eResolveProxy(oldTextFont);
			if (textFont != oldTextFont) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.FONT__TEXT_FONT, oldTextFont, textFont));
			}
		}
		return textFont;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalStyle basicGetTextFont() {
		return textFont;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTextFont(ConcreteGraphicalStyle newTextFont) {
		ConcreteGraphicalStyle oldTextFont = textFont;
		textFont = newTextFont;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.FONT__TEXT_FONT, oldTextFont, textFont));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalStyle getEReference0() {
		if (eReference0 != null && eReference0.eIsProxy()) {
			InternalEObject oldEReference0 = (InternalEObject)eReference0;
			eReference0 = (ConcreteGraphicalStyle)eResolveProxy(oldEReference0);
			if (eReference0 != oldEReference0) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.FONT__EREFERENCE0, oldEReference0, eReference0));
			}
		}
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalStyle basicGetEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(ConcreteGraphicalStyle newEReference0) {
		ConcreteGraphicalStyle oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.FONT__EREFERENCE0, oldEReference0, eReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.FONT__TYPE:
				return getType();
			case Usixml_cuiPackage.FONT__SIZE:
				return new Integer(getSize());
			case Usixml_cuiPackage.FONT__IS_BOLD:
				return isIsBold() ? Boolean.TRUE : Boolean.FALSE;
			case Usixml_cuiPackage.FONT__IS_ITALIC:
				return isIsItalic() ? Boolean.TRUE : Boolean.FALSE;
			case Usixml_cuiPackage.FONT__TEXT_FONT:
				if (resolve) return getTextFont();
				return basicGetTextFont();
			case Usixml_cuiPackage.FONT__EREFERENCE0:
				if (resolve) return getEReference0();
				return basicGetEReference0();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.FONT__TYPE:
				setType((FontType)newValue);
				return;
			case Usixml_cuiPackage.FONT__SIZE:
				setSize(((Integer)newValue).intValue());
				return;
			case Usixml_cuiPackage.FONT__IS_BOLD:
				setIsBold(((Boolean)newValue).booleanValue());
				return;
			case Usixml_cuiPackage.FONT__IS_ITALIC:
				setIsItalic(((Boolean)newValue).booleanValue());
				return;
			case Usixml_cuiPackage.FONT__TEXT_FONT:
				setTextFont((ConcreteGraphicalStyle)newValue);
				return;
			case Usixml_cuiPackage.FONT__EREFERENCE0:
				setEReference0((ConcreteGraphicalStyle)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.FONT__TYPE:
				setType(TYPE_EDEFAULT);
				return;
			case Usixml_cuiPackage.FONT__SIZE:
				setSize(SIZE_EDEFAULT);
				return;
			case Usixml_cuiPackage.FONT__IS_BOLD:
				setIsBold(IS_BOLD_EDEFAULT);
				return;
			case Usixml_cuiPackage.FONT__IS_ITALIC:
				setIsItalic(IS_ITALIC_EDEFAULT);
				return;
			case Usixml_cuiPackage.FONT__TEXT_FONT:
				setTextFont((ConcreteGraphicalStyle)null);
				return;
			case Usixml_cuiPackage.FONT__EREFERENCE0:
				setEReference0((ConcreteGraphicalStyle)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.FONT__TYPE:
				return type != TYPE_EDEFAULT;
			case Usixml_cuiPackage.FONT__SIZE:
				return size != SIZE_EDEFAULT;
			case Usixml_cuiPackage.FONT__IS_BOLD:
				return isBold != IS_BOLD_EDEFAULT;
			case Usixml_cuiPackage.FONT__IS_ITALIC:
				return isItalic != IS_ITALIC_EDEFAULT;
			case Usixml_cuiPackage.FONT__TEXT_FONT:
				return textFont != null;
			case Usixml_cuiPackage.FONT__EREFERENCE0:
				return eReference0 != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (type: ");
		result.append(type);
		result.append(", size: ");
		result.append(size);
		result.append(", isBold: ");
		result.append(isBold);
		result.append(", isItalic: ");
		result.append(isItalic);
		result.append(')');
		return result.toString();
	}

} //FontImpl
